package GUIStudy.Project.PuzzleGame.TestProgramPart;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class TestEvent implements KeyListener {
    @Override
    public void keyTyped(KeyEvent e) {

    }

    @Override
    public void keyPressed(KeyEvent e) {
        int press = e.getKeyCode();
        if(press == 37){
            System.out.println("向左移动");
        } else if (press == 38) {
            System.out.println("向上移动");
        } else if (press == 39) {
            System.out.println("向右移动");
        } else if (press == 40) {
            System.out.println("向下移动");
        }
    }

    @Override
    public void keyReleased(KeyEvent e) {

    }
}
